package com.example.java8.feature_05.func_interface;

import java.util.function.Consumer;

public class TestConsumer {

    /**
     * Consumer<T> 消费型接口
     * T: 入参类型
     */
    public static void main(String[] args){
        // lambda表达式创建对象
        Consumer<String> consumer = obj -> {
           System.out.println("发送邮件到:" + obj);
        };

        push("888@123.com", consumer);
        push("256@123.com", obj -> {
            System.out.println("发送邮件到:" + obj);
        });
    }

    public static void push(String email, Consumer<String> consumer){
        consumer.accept(email);
    }

}
